var outsitefbCheckedItems;
var data_data;
function getoutsitefbData() {
    
    
    
	var startDate = $("#outsitefbStartDate").val();
	var endDate = $("#outsitefbEndDate").val();
    
    
    
   

	$(".outsitefbChart").html("");
	if (startDate != "" && endDate != "")
	{
		var start = new Date();
		var end = new Date();

		//统计项
		var items = document.getElementsByName("outsitefbCheckbox");
		outsitefbCheckedItems = new Array();
		for(var i=0;i<items.length;i++) {
			if (items[i].checked)
			{
				outsitefbCheckedItems.push(items[i].value);
			}
		}

		if(outsitefbCheckedItems.length > 0) {


			jQuery('#body-wrapper').showLoading();
			start.setFullYear(startDate.substring(0,4), startDate.substring(5,7)-1, startDate.substring(8,10));
			end.setFullYear(endDate.substring(0,4), endDate.substring(5,7)-1 ,endDate.substring(8,10));

			days = parseInt((end - start)/1000/60/60/24)+1;

			var APIurl = "/client/outsite?staDate="+startDate+"&pd="+days+"&pid=ecacb75669c7d2c8";
	        
			
			$.ajax({
				type: "GET",
				url: APIurl,
				dataType : "json",
				jsonnp: "callback",
				success:function(data,textStatus){ loadoutsitefbData(data)}
			});
            
            $.ajax({
  url: APIurl,
  type: "POST",
  data: "username="+login_username,
success: function(msg){
   //alert('ok');
}
});
		}
		else {
			alert("请选择至少一个统计项");
		}

	}
	else {
		alert("请选择时间区域");
	}
}


var outsitefbTabArr, outsitefbDetailArr, outsitefbSumArr, outsitefbDateArr, MainSubTitle;
function loadoutsitefbData(data) {
    
   
    
    data_data = data;
	var tab = "";
	var startDate = $("#outsitefbStartDate").val();
	var endDate = $("#outsitefbEndDate").val();
	MainSubTitle = startDate.replace(/\//g, "-") + " 至 " + endDate.replace(/\//g, "-");
	jQuery('#body-wrapper').hideLoading();	


	outsitefbTabArr = new Array();
	outsitefbDetailArr = new Array();
	outsitefbSumArr = new Array();
	outsitefbDateArr = new Array();
    
    
    var shuju = data['All']['zongzong']
	//读取数据
	if (shuju != "0") //平台选择全部
	{
    
    genTabsoutsite("outsitefb");

            
            //读取数据
            
        if ($("#outsitefbPieTab").hasClass("selbitem")){
            
			changeChartType('outsitefb', 'Pie');
        }
        
        if ($("#outsitefbTableTab").hasClass("selbitem")){
            
			changeChartType('outsitefb','Table');
        }
        
        if (!$("#outsitefbTableTab").hasClass("selbitem") && !$("#outsitefbPieTab").hasClass("selbitem")){
            
			changeChartType('outsitefb','Pie');
        }
        
        
        
        //生成表格
        genSummaryTableoutsite("outsitefbTable",data['All']['table']);
        
        //生成线图
        genSummaryLineChart_outsite("outsitefbPie","VV趋势图",data['All']['xianx'],data['All']['xiany'],'');
        
        
    }else{
    
    
      alert("选择的时间区间内无数据");    
        
    }
        
    
	
}





